<div class="layuimini-main">
       <form action="/edit">
        <div class="layui-form layuimini-form">
            <!--申请理由-->
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">申请理由</label>
                <div class="layui-input-block">
                    <textarea name="reason" placeholder="你要钱的借口" class="layui-textarea"></textarea>
                </div>
            </div>
            <!--申请的金额-->
            <!--<div class="layui-form-item">
                <label class="layui-form-label">申请金额</label>
                <div class="layui-input-block">
                    <input type="text" name="money" lay-verify="required" lay-reqtext="这个不填,怎么拿钱" placeholder="公司不富有，但是也不是很穷，不浪费就行" autocomplete="off" class="layui-input">
                </div>
            </div>-->
            <!--票据，有发票的时候需要上传文件-->
            <div class="layui-form-item">
                <label class="layui-form-label">发票上传</label>
                <div class="layui-input-block">
                    <input type="file" name="bill"  autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
       </form>
</div>
<script>
    layui.use(['form', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.$;

        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var index = layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息',
            }, function () {
               /* $.ajax({
                    url:"/edit",
                    data:{
                        id:data.cwbPId,
                        applyreason:data.cwbPApplyreason,
                        applymoney:data.cwbPMoney,
                        bill:cwbPBill
                    },
                    dateType: "json",
                    success:function (data) {
                        if(data != null){
                            alert("成功");
                            console.log(data)
                        }
                    }
                });*/
                // 关闭弹出层
                layer.close(index);
                layer.close(parentIndex);

            });

            return true;
        });

    });
</script>